import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [

  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login.vue'),
    meta: {
      title: '登录',
    }
  },
  {
    path: '/',
    name: 'Layout',
    redirect: '/index',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/index',
        name: 'Home',
        component: () => import('@/views/Home.vue'),
        meta: {
          title: '接单大厅',
          role: [1, 2],
          icon: 'wap-home',
          isTabbar: true
        }
      },
      {
        path: '/rank',
        name: 'Rank',
        component: () => import('@/views/Rank.vue'),
        meta: {
          title: '排行榜',
          role: [2],
          icon: 'gold-coin',
          isTabbar: true
        }
      },
      {
        path: '/user',
        name: 'User',
        component: () => import('@/views/Player.vue'),
        meta: {
          title: '用户',
          role: [1],
          icon: 'friends',
          isTabbar: true
        }
      },
      {
        path: '/mine',
        name: 'Mine',
        component: () => import('@/views/Mine.vue'),
        meta: {
          title: '我的',
          icon: 'contact',
          role: [1, 2],
          isTabbar: true
        }
      },
      {
        path: '/mine/modify',
        name: 'ModifyInfo',
        component: () => import('@/views/ModifyInfo.vue'),
        meta: {
          title: '修改资料',
          icon: 'contact',
          isTabbar: false
        }
      },
      {
        path: '/order/modify',
        name: 'ModifyOrder',
        component: () => import('@/views/OrderModify.vue'),
        meta: {
          title: '修改订单',
          icon: 'contact',
          isTabbar: false
        }
      },
      {
        path: '/order/complate',
        name: 'PlayerOrder',
        component: () => import('@/views/playerOrder.vue'),
        meta: {
          title: '完成订单',
          icon: 'contact',
          isTabbar: false
        }
      },
      // 
      {
        path: '/mine/amount',
        name: 'MyCart',
        component: () => import('@/views/MyCart.vue'),
        meta: {
          title: '我的钱包',
          icon: 'contact',
          isTabbar: false
        }
      },
      {
        path: '/mine/order',
        name: 'MyOrder',
        component: () => import('@/views/MyOrder.vue'),
        meta: {
          title: '接单历史',
          icon: 'contact',
          isTabbar: false
        }
      },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
